// skate.js
Page({

  data: {
    imgUrls: [
      'http://www.whatsupmag.cn/uploadfile/2017/0616/20170616032039264.jpg',
      'http://www.whatsupmag.cn/uploadfile/2016/0607/20160607095040569.jpg'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 4000,
    duration: 1000,

    list: [
      {
        id: 'view',
        name: '国内比赛',
        open: false,
        pageName:['全国','北京','上海','广州','深圳'],
        pages: ['match_country', 'match_beijing', 'match_shanghai', 'match_guangzhou','match_shenzhen']
      }, {
        id: 'content',
        name: '关注国外',
        open: false,
        pageName: ['SLS', 'X-Game'],
        pages: ['match_sls', 'match_xgame']
      }, {
        id: 'form',
        name: '赛事结果',
        open: false,
        pageName: ['Game of Sk', '硬碰硬'],
        pages: ['match_result_sk', 'match_result_yingpengying']
      }, {
        id: 'nav',
        name: '精彩回放',
        open: false,
        pageName: ['大绝招'],
        pages: ['match_playback_besttrick']
      }, {
        id: 'media',
        name: '线上比赛',
        open: false,
        pageName: ['我要报名'],
        pages: ['match_online_signup']
      }
    ]
  },

  kindToggle: function (e) {
    var id = e.currentTarget.id, list = this.data.list;
    for (var i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open
      } else {
        list[i].open = false
      }
    }
    this.setData({
      list: list
    });
  },

  changeIndicatorDots: function (e) {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },
  changeAutoplay: function (e) {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },
  intervalChange: function (e) {
    this.setData({
      interval: e.detail.value
    })
  },
  durationChange: function (e) {
    this.setData({
      duration: e.detail.value
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})